using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using T2.WebSecurity.Business;
using T2.WebSecurity.ASPMVC.Entity;
using T2.WebSecurity.ASPMVC.Entity.Interface;
using T2.WebSecurity.ASPMVC.Entity.Search;
using T2.WebSecurity.ASPMVC.Entity.Search.Interface;
using T2.WebSecurity.Business.Entities;
using T2.WebSecurity.Business.Entities.Interfaces;
using T2.WebSecurity.ASPMVC.Entity.Translators;
using T2.WebSecurity.Business.Entities.Search.Interfaces;
using T2.WebSecurity.Business.Entities.Search;
using T2.WebSecurity.ASPMVC.ViewModel;
using System.Web.Http;
using System.Net.Http;
using System.Net;

namespace T2.WebSecurity.ASPMVC.Controllers
{
    public partial class ApplicationProfileDataAPIController : ApiController
    {
        public HttpResponseMessage PostApplicationProfileData(ApplicationProfileData_ui param)
        {
            try
            {
                ApplicationProfileDataViewModel model = new ApplicationProfileDataViewModel(false);
                Int32 retVal = model.Set(param);
                if (retVal == 1)
                {
                    HttpResponseMessage message = new HttpResponseMessage();
                    message.ReasonPhrase = "Completed saving ApplicationProfileData";
                    message.StatusCode = HttpStatusCode.OK;
                    return message;
                }
                else
                {
                    HttpResponseMessage message = new HttpResponseMessage();
                    message.ReasonPhrase = "ApplicationProfileData did not save";
                    message.StatusCode = HttpStatusCode.NotAcceptable;
                    return message;
                }
            }
            catch (Exception ex)
            {
                HttpResponseMessage message = new HttpResponseMessage();
                message.ReasonPhrase = ex.Message;
                message.StatusCode = HttpStatusCode.InternalServerError;
                return message;
            }
        }	

		public List<IApplicationProfileData_ui> GetApplicationProfileData(ApplicationProfileData_ui param)
        {
            try
            {
                ApplicationProfileDataViewModel model = new ApplicationProfileDataViewModel(false);
                List<IApplicationProfileData_ui> retVal = model.ModelList(param);
                return retVal;
            }
            catch (Exception ex)
            {
                HttpResponseMessage message = new HttpResponseMessage();
                message.ReasonPhrase = ex.Message;
                message.StatusCode = HttpStatusCode.InternalServerError;
                throw new HttpResponseException(message);  
            }
        }
		
		public List<IApplicationProfileData_ui> GetApplicationProfileDataSearch(ApplicationProfileDataSearch_ui param)
        {
            try
            {
                ApplicationProfileDataViewModel model = new ApplicationProfileDataViewModel(false);
                List<IApplicationProfileData_ui> retVal = model.SearchList(param);
                return retVal;
            }
            catch (Exception ex)
            {
                HttpResponseMessage message = new HttpResponseMessage();
                message.ReasonPhrase = ex.Message;
                message.StatusCode = HttpStatusCode.InternalServerError;
                throw new HttpResponseException(message);  
            }
        }	


    }
}